From 87ea632393a00d114633357d8d97ca75da7b1760 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 9 Feb 2005 16:21:20 +0000 Subject: [PATCH] Implement Hiketech track writing. --- gpsbabel/hiketech.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/gpsbabel/hiketech.c b/gpsbabel/hiketech.c index 67377cde2..0e56e2459 100644 --- a/gpsbabel/hiketech.c +++ b/gpsbabel/hiketech.c @@ -103,7 +103,44 @@ hiketech_wr_deinit(void) } static void -hiktech_waypt_pr(const waypoint *wpt) +hiketech_trk_hdr(const route_head *rte) +{ + fprintf(ofd, "\n"); + write_optional_xml_entity(ofd, " ", "ident", rte->rte_name); +} + +static void +hiketech_trk_tlr(const route_head *rte) +{ + fprintf(ofd, "\n"); +} + +void +hiketech_print_utc(time_t tm, const char *indent, const char *tag) +{ + char tbuf[80]; + strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %I:%M:%S", gmtime(&tm)); + fprintf(ofd, "%s<%s>%s\n",indent,tag,tbuf,tag); +} + +static void +hiketech_trkpt_pr(const waypoint *waypointp) +{ + fprintf(ofd, " \n"); + if (waypointp->creation_time) { + hiketech_print_utc(waypointp->creation_time, " ", "utc"); + } + fprintf(ofd, " %f\n", waypointp->latitude); + fprintf(ofd, " %f\n", waypointp->longitude); + if (waypointp->altitude != unknown_alt) { + fprintf(ofd, " %f\n", + waypointp->altitude); + } + fprintf(ofd, " \n"); +} + +static void +hiketech_waypt_pr(const waypoint *wpt) { fprintf(ofd, "\n"); write_xml_entity(ofd, "\t", "ident", wpt->shortname); @@ -122,9 +159,11 @@ hiktech_waypt_pr(const waypoint *wpt) void hiketech_write(void) { - fprintf(ofd, "\n"); + fprintf(ofd, "\n"); fprintf(ofd, "\n"); - waypt_disp_all(hiktech_waypt_pr); + track_disp_all(hiketech_trk_hdr, hiketech_trk_tlr, hiketech_trkpt_pr); + track_disp_all(NULL, NULL, hiketech_trkpt_pr); + waypt_disp_all(hiketech_waypt_pr); fprintf(ofd, "\n"); fprintf(ofd, "\n"); } -- 2.30.2